package com.ditri.distrident.commonservice.service.impl;

import com.ditri.distrident.common.entity.BlackUserList;
import com.ditri.distrident.commonservice.dao.BlackUserListDao;
import com.ditri.distrident.commonservice.service.BlackUserListService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (BlackUserList)表服务实现类
 *
 * @author edxuanlen
 * @since 2020-08-07 22:02:08
 */
@Service("blackUserListService")
public class BlackUserListServiceImpl implements BlackUserListService {
    @Resource
    private BlackUserListDao blackUserListDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public BlackUserList queryById(Long id) {
        return this.blackUserListDao.queryById(id);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<BlackUserList> queryAllByLimit(int offset, int limit) {
        return this.blackUserListDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param blackUserList 实例对象
     * @return 实例对象
     */
    @Override
    public BlackUserList insert(BlackUserList blackUserList) {
        this.blackUserListDao.insert(blackUserList);
        return blackUserList;
    }

    /**
     * 修改数据
     *
     * @param blackUserList 实例对象
     * @return 实例对象
     */
    @Override
    public BlackUserList update(BlackUserList blackUserList) {
        this.blackUserListDao.update(blackUserList);
        return this.queryById(blackUserList.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long id) {
        return this.blackUserListDao.deleteById(id) > 0;
    }
}